﻿using Microsoft.EntityFrameworkCore;

namespace EntityModels.DbContexts
{
    /// <summary>
    /// 排序规则
    /// </summary>
    public class CollationDbContext : DbContext
    {
        public DbSet<CollationEntity> collationEntities => Set<CollationEntity>();

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.UseCollation("German_PhoneBook_CI_AS");

            modelBuilder.Entity<CollationEntity>().Property(c => c.Text).UseCollation("German_PhoneBook_CI_AS");
        }

    }
    public class CollationEntity
    {
        public int Id { get; set; }
        public string Text { get; set; }
    }

}
